//
//  CKBaseNavigationController.swift
//  CKWeiBo
//
//  Created by 陈科 on 2017/1/5.
//  Copyright © 2017年 CK. All rights reserved.
//

import UIKit

class CKBaseNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        
    }
    
    //HMBaseNavController(rootViewController: vc) 在内部进行了push的操作 进行压栈,所以可以从写push方法
    override func pushViewController( _ viewController: UIViewController, animated: Bool){
        //完成统一操作: 1. 进入子页面隐藏底部的tabBar 2. 设置返回按钮
        
        let count = self.childViewControllers.count
        
        if count > 0 {
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(pop))
            
            viewController.hidesBottomBarWhenPushed = true
        }
        
        
        super.pushViewController(viewController, animated: true)
    }
    
    func pop(){
        self.popViewController(animated: true)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    

}
